cmake_minimum_required(VERSION 3.1.0)

project(NORM)

set(CMAKE_AUTOMOC ON)

find_package(Qt5Core)
find_package(Qt5Sql)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(NORM_INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/NORM/inc)

aux_source_directory(${CMAKE_SOURCE_DIR}/NORM/src NORM_SRC)
file(GLOB NORM_INC ${CMAKE_SOURCE_DIR}/NORM/inc/*.h)

add_library(norm SHARED ${NORM_SRC} ${NORM_INC})

include_directories(${CMAKE_SOURCE_DIR}/NORM/inc)

target_link_libraries(norm Qt5::Core Qt5::Sql)

install(CODE "FILE(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})")

install(DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ DESTINATION lib USE_SOURCE_PERMISSIONS)
install(DIRECTORY ${NORM_INCLUDE_DIRECTORY}/ DESTINATION include/norm USE_SOURCE_PERMISSIONS)
